<template>
  <div>
    <el-button @click="init">init</el-button>
    <el-button @click="rfid_init">rfid_init</el-button>
    <el-button @click="rfid_read_card">rfid_read_card</el-button>
    <el-button @click="rfid_end_read_card">rfid_end_read_card</el-button>
    <reko_rfid ref="reko_rfid"></reko_rfid>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rfid_client: null
    }
  },
  created() {

  },
  methods: {
    init() {
      var listener = {
        set_callback: res => {
          if (res.code) {
            console.log(res);
            //枚举如下
            //debug_send = -100,
            //debug_receive = -200,
            //未定义 = -1,
            //获取读写器模块信息 = 1000,
            //设置发射功率 = 1001,
            //获取发射功率 = 1002,
            //读取卡信息 = 1003,
            //停止轮询卡信息 = 1004,
            //其他内容自己看去
          } else {

          }
        }
      };
      this.$refs.reko_rfid.init(listener, s => {
        this.rfid_client = s
      });

      console.log(this.$refs.reko_rfid);
    },
    rfid_init() {
      this.rfid_client.rfid_init();
    },
    rfid_read_card() {
      this.rfid_client.rfid_read_card();
    },
    rfid_end_read_card() {
      this.rfid_client.rfid_end_read_card();
    },
  }
}
</script>

<style scoped>

</style>
